<template>
  <div class="serviceManagementTopp">
    <serviceManagementTop @subFn="searchFn3" />
    <serviceManagementDown :searchList="list" @subFndel="servedel" />
  </div>
</template>

<script>
import axios from "axios";
axios.defaults.baseURL = "http://localhost:8080/";
import serviceManagementTop from "../../components/Serve/serviceManagementTop.vue";
import serviceManagementDown from "../../components/Serve/serviceManagementDown.vue";
export default {
  components: {
    serviceManagementTop,
    serviceManagementDown,
  },
  data() {
    return {
      list: [],
    };
  },
  methods: {
    servedel(id) {
      axios({
        url: "data/serveDel",
        method: "GET",
        params: {
          id: id,
        },
      }).then((res) => {
        this.$notify({
          title: "成功",
          message: "删除成功",
          type: "success",
        });
        this.queryList();
      });
    },
    // 条查
    searchFn3(project_type, project_name) {
      axios({
        url: "data/getServeObjList",
        method: "GET",
        params: {
          project_type: project_type,
          project_name: project_name,
        },
      }).then((res) => {
        this.list = res.data; //把值传到list里面
        console.log("王帅龙" + res);
      });
    },
    queryList() {
      axios({
        url: "data/getServeObjList",
        method: "GET",
      }).then((res) => {
        this.list = res.data; //把值传到list里面
        console.log("王帅龙" + res);
      });
    },
  },
  created() {
    this.queryList();
    document
      .querySelector("body")
      .setAttribute("style", "background-color:#F2F7FB");
  },
};
</script>

<style>
.serviceManagementTopp {
  width: 1150px;
  height: 1000px;
  background: white;
  margin: 20px auto;
  box-sizing: border-box;
  padding: 10px;
}
</style>